package com.fr.base.core.antlr;

public class StringUtils
{
  public static String stripBack(String paramString, char paramChar)
  {
    while ((paramString.length() > 0) && (paramString.charAt(paramString.length() - 1) == paramChar))
      paramString = paramString.substring(0, paramString.length() - 1);
    return paramString;
  }

  public static String stripBack(String paramString1, String paramString2)
  {
    int i;
    int j;
    do
    {
      i = 0;
      for (j = 0; j < paramString2.length(); ++j)
      {
        int k = paramString2.charAt(j);
        while ((paramString1.length() > 0) && (paramString1.charAt(paramString1.length() - 1) == k))
        {
          i = 1;
          paramString1 = paramString1.substring(0, paramString1.length() - 1);
        }
      }
    }
    while (i != 0);
    return paramString1;
  }

  public static String stripFront(String paramString, char paramChar)
  {
    while ((paramString.length() > 0) && (paramString.charAt(0) == paramChar))
      paramString = paramString.substring(1);
    return paramString;
  }

  public static String stripFront(String paramString1, String paramString2)
  {
    int i;
    int j;
    do
    {
      i = 0;
      for (j = 0; j < paramString2.length(); ++j)
      {
        int k = paramString2.charAt(j);
        while ((paramString1.length() > 0) && (paramString1.charAt(0) == k))
        {
          i = 1;
          paramString1 = paramString1.substring(1);
        }
      }
    }
    while (i != 0);
    return paramString1;
  }

  public static String stripFrontBack(String paramString1, String paramString2, String paramString3)
  {
    int i = paramString1.indexOf(paramString2);
    int j = paramString1.lastIndexOf(paramString3);
    if ((i == -1) || (j == -1))
      return paramString1;
    return paramString1.substring(i + 1, j);
  }
}